/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.FileWriter;
import java.io.IOException;
import java.util.UUID;

/**
 * <p>Project: jse2303 - File2
 * <p>Powered by webrx On 2023-07-20 16:31:32
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class File2 {
    public static void main(String[] args) {
        //在当前项目目录下，如果文件存在就append追加内容
        //如果不存在，就直接创建文件
        for (int i = 0; i < 10; i++) {
            UUID uuid = UUID.randomUUID();
            String fn = String.format("%s%s", "c:/users/administrator/desktop/", uuid.toString() + ".txt");
            try (var out = new FileWriter(fn, true)) {
                out.write("我的第一个文件\r\n");
                out.write("我的第一个文件\r\n");
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
